home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_01
/
8n01045a
< prev
next >
Wrap
Text File
|
1990-02-18
|
11KB
|
410 lines
1 /*
2 * e n v i r o n . h
3 * -----------------
4 * This module contains environment specific information.
5 * It's used to make the programs more portable.
6 *
7 * @(#)Copyrigth (C) by Rainer Gerhards. All rights reserved.
8 *
9 * Include-file selection defines are:
10 *
11 * Define Class
12 * ----------------------------------------------------------------------
13 * INCL_ASSERT assert macro and needed functions
14 * INCL_CONIO low-level console i/o
15 * INCL_CONVERT conversion and classification functions
16 * INCL_CTYPE ctype.h
17 * INCL_CURSES curses.h
18 * INCL_LLIO low-level i/o
19 * INCL_MEMORY memory acclocation/deallocation functions
20 * INCL_MSDOS MS-DOS support
21 * INCL_PROCESS process control
22 * INCL_STDIO stdio.h
23 * INCL_STDLIB standard library functions
24 * INCL_STRING string handling functions
25 */
26 #ifndef ENVIRON_H
27 #define ENVIRON_H
28 #undef MSDOS
29 #undef OS2
30 #undef UNIX
31 #undef STARSYS
32 /*
33 * configurable parameters.
34 * modify the following parameters according to the target environment.
35 */
36 /*
37 * define target operating system
38 */
39 #define MSDOS 0
40 #define UNIX 0
41 #define OS2 1
42 #define STARSYS 0
43 /*
44 * define target machine
45 *
46 * This is auxiluary data only needed for some operating
47 * systems. Currently only needed if MS-DOS is active.
48 */
49 #define IBM_PC 1 /* IBM PC, XT, AT & compatibels */
50 #define WANG_PC 0 /* Wang PC, APC ... */
51 /*
52 * define target compiler (if neccessary)
53 */
54 #undef MSC
55 #define MSC 1 /* Microsoft C */
56 #define AUTO_SEL 1
57 /*
58 * The above #define allowes an automatic language set selection. It is
59 * only functional if the used compiler identifies itself via a #define.
60 *
61 * Note: If AUTO_SEL is set, the parameters below are meaningless!
62 */
63 #define USE_FAR 0 /* use far keyword */
64 #define USE_NEAR 0 /* use near keyword */
65 #define USE_VOID 1 /* use void keyword */
66 #define USE_VOLA 0 /* use volatile keyword */
67 #define USE_CONST 0 /* use const keyword */
68 #define USE_PROTT 0 /* use function prototypes */
69 #define USE_INTR 0 /* use interrupt keyword */
70 /* +----------------------------------------------------------------+
71 * | End Of Configurable Parameters |
72 * +----------------------------------------------------------------+
73 * Please do not make any changes below this point!
74 */
75 #ifndef SYMDEB
76 # define SYMDEB 0
77 #endif
78 /*
79 * Check target compiler. Note that the MSC switch is overriden if
80 * either __TURBOC__ or DLC are defined.
81 */
82 #ifdef __TURBOC__
83 # undef MSC
84 #endif
85 #ifdef DLC
86 # undef MSC
87 #endif
88 #if STARSYS
89 # undef MSC
90 #endif
91 #if !(MSDOS || OS2)
92 # undef MSC
93 # undef AUTO_SEL
94 # define AUTO_SEL 0
95 #endif
96 #if OS2
97 # undef MSC
98 # define MSC 1
99 # undef AUTO_SEL
100 # define AUTO_SEL 1
101 #endif
102 /*
103 * Compiler ANSI-compatible?
104 * (First we assume it's not!)
105 */
106 #define ANSI_C 0
107 #ifdef MSC
108 # undef ANSI_C
109 # define ANSI_C 1
110 #endif
111 #ifdef TURBO_C
112 # undef ANSI_C
113 # define ANSI_C 1
114 #endif
115 #if AUTO_SEL
116 # undef USE_FAR
117 # undef USE_NEAR
118 # undef USE_VOID
119 # undef USE_VOLA
120 # undef USE_CONST
121 # undef USE_PROTT
122 # undef USE_INTR
123 # ifdef __TURBOC__
124 # define USE_FAR 1
125 # define USE_NEAR 1
126 # define USE_VOID 1
127 # define USE_VOLA 1
128 # define USE_CONST 1
129 # define USE_PROTT 1
130 # define USE_INTR 1
131 # endif
132 # ifdef DLC
133 # define USE_FAR 1
134 # define USE_NEAR 1
135 # define USE_VOID 1
136 # define USE_VOLA 1
137 # define USE_CONST 1
138 # define USE_PROTT 1
139 # define USE_INTR 0
140 # endif
141 # ifdef MSC
142 # define USE_FAR 1
143 # define USE_NEAR 1
144 # define USE_VOID 1
145 # define USE_VOLA 1
146 # define USE_CONST 1
147 # define USE_PROTT 1
148 # define USE_INTR 1
149 # endif
150 #endif
151 #if !USE_FAR
152 #define far
153 #endif
154 #if !USE_NEAR
155 #define near
156 #endif
157 #if !USE_VOID
158 #define void
159 #endif
160 #if !USE_VOLA
161 #define volatile
162 #endif
163 #if !USE_CONST
164 #define const
165 #endif
166 #if USE_INTR
167 # ifdef MSC
168 # define INTERRUPT interrupt far
169 # else
170 # define INTERRUPT interrupt
171 # endif
172 #else
173 # define INTERRUPT
174 #endif
175 #if USE_PROTT
176 # define PROTT(x) x
177 # ifdef MSC
178 # define STATICPT(func, prott) static func prott
179 # else
180 # define STATICPT(func, prott) extern func prott
181 # endif
182 #else
183 # define PROTT(x) ()
184 # ifdef MSC
185 # define STATICPT(func, prott) static func ()
186 # else
187 # define STATICPT(func, prott) extern func ()
188 # endif
189 #endif
190 #ifdef MSC
191 # define inportb(port) inp(port)
192 # define outportb(port, val) outp(port, val)
193 #endif
194 #ifdef __TURBOC__
195 # define REGPKT struct REGS
196 #else
197 # define REGPKT union REGS
198 #endif
199 #ifdef DLC
200 # define defined(x)
201 # define inportb inp
202 # define outportb outp
203 #endif
204 #if !SYMDEB /* symbolic debugging support */
205 # define STATICATT static
206 #endif
207 #if STARSYS
208 # define exit(x) dx_exit(x)
209 #endif
210 /*
211 * Define open modes according to selected operating system/compiler.
212 */
213 #if MSDOS || OS2
214 # define OPM_WB "wb"
215 # define OPM_WT "wt"
216 # define OPM_RB "rb"
217 # define OPM_RT "rt"
218 #endif
219 #if UNIX
220 # define OPM_WB "w"
221 # define OPM_WT "w"
222 # define OPM_RB "r"
223 # define OPM_RT "r"
224 #endif
225 #define TRUE 1
226 #define FALSE 0
227 typedef unsigned char uchar;
228 typedef int bool;
229 typedef unsigned short ushort;
230 typedef unsigned long ulong;
231 #define tonumber(x) ((x) - '0')
232 #define FOREVERL() for(;;)
233 /*
234 * Select #include-files depending on target compiler and OS.
235 *
236 * Phases:
237 * 1. Define all include selection constants to true or false.
238 * 2. Select actual include files and include them.
239 * 3. #Undef all include selection constants.
240 */
241 #ifndef INCL_STDIO
242 # define INCL_STDIO 0
243 #else
244 # undef INCL_STDIO
245 # define INCL_STDIO 1
246 #endif
247 #ifndef INCL_CURSES
248 # define INCL_CURSES 0
249 #else
250 # undef INCL_CURSES
251 # define INCL_CURSES 1
252 #endif
253 #ifndef INCL_CTYPE
254 # define INCL_CTYPE 0
255 #else
256 # undef INCL_CTYPE
257 # define INCL_CTYPE 1
258 #endif
259 #ifndef INCL_ASSERT
260 # define INCL_ASSERT 0
261 #else
262 # undef INCL_ASSERT
263 # define INCL_ASSERT 1
264 #endif
265 #ifndef INCL_LL